Let XYZ be a triangle. Then the area of XYZ is given by , where B is the number of boundry lattice points; I is the number of interior lattice points.
This is the special case (for triangles) of Pick's Theorem. See
Pick's theorem - Wikipedia, the free encyclopedia
However, you left out a condition: The vertices of the triangle (or polygon, in the general case) must lie on grid points.
I agree with you, it's a fascinating theorem.