Lines don't end (but libes, do; the one at Beloit College did back in the early '60s and it was replaced by a new one, but that's a whole nother story) but line segments do end. Those squares are all bounded by line segments. If you extend all those line segments to infinity you get 30 squares by my count.