how many rectangles in this shape I've learned in my high school the solution to such riddle:
How many rectangles are there in this shape:

the solution is through combinations:
in this shape is a $5\times 6$ grid so the number of rectangles would be:
$C^2_5 * C_6^2 $
I would like to know if this is possible in case of triangles? squares? is there a general rule for this?

The answer is actually $C^2_6 * C_5^2 $ in this case, and for an m x n grid, the answer is $C^2_m * C_n^2 $.
