(answer adapted from Balaji Reddy on Quora)
First of all, let's see how many one-row rectangles there are.
1 x 1 rectangles = (9–1)*(9–1) = 64
1 x 2 rectangles = (9–1)*(9–2) = 56
1 x 3 rectangles = (9–1)*(9–3) = 48
1 x 4 rectangles = 5 * 8 = 40
1 x 5 rectangles = 4 * 8 = 32
1 x 6 rectangles = 3 * 8 = 24
1 x 7 rectangles = 2 * 8 = 16
1 x 8 rectangles = 1 * 8 = 08
Total = 64+56+48+40+32+24+16+8 = 288 1-row rectangles!
There's a pattern here :D
Total one row rectangles = 8*1+8*2+…+8*8
= 8 * (1+2+…+8)
= 8 * (8*9/2) Since,n(n+1)/2 = sum of all numbers below n
=8 * 36
Similarly, Two row rectangles = 7 * (1+2+…+8)
=7 * 36
So all rows rectangles = 8*36+7*36+…+1*36
= 36 * (1+2+…+8)
= 36 * 36
It's \(\fbox{1296}\) :)
BTW, this also counts all the squares!