Perimeter: grid squares and polygons