We can observe a pattern when taking 1x1 shape, then 2x2 shape and so on, while (manually) counting number of rectanglesin each. So we get for:
1x1: 1 rectangles
2x2: 9 rectangles
3x3: 36 rectangles
Here we observe a pattern that is
$1^2$, $3^2$, $6^2$, $10^2$
which goes like 1,(1+2),(1+2+3),(1+2+3+4) //each term squared
then on continuing this way we get
5x5: $15^2$ rectangles, 6x6: $21^2$ rectangles, 7x7=$28^2$ rectangles
and for 8x8: $36^2$ rectangles= 1296 rectangles
I am not sure if this way is correct.