There are 4 horizontal and 4 vertical lines, parallel and equidistant ...
4 vertical and 4 horizontal lines
Squares are: a, b, c, d, e, f, g, h, i, (abde), (bcef), (degh), (efhi), ABCD
Rectangles are: (ab), (bc), (de), (ef), (gh), (hi), (ad), (dg), (be), (eh), (cf), (fi),
(abc), (def), (ghi), (adg), (beh), (cfi),
(abcdef), (defghi), (adgbeh), (behcfi)
Required number = 14 + 22 = 36