Counting Embedded Figures- Triangles

How many triangles are in the figure below? Only consider triangles that can be constructed from the vertices of the squares in the figure.

How many triangles are in a 3 x 3 figure? In a 4 x 4 figure?