Grid within a flat irregular shape

I’m having difficulty creating a grid which is only angular. See the image

So if the grid goes over the shape it gets deleted. Only the full ‘squares are allowed’.

It can be a grid or a series of squares it doesn’t matter for me

Is it good enough to check the four corners of each square to see if they are within the bounding region? Or are there cases where only some part of one edge would poke out?

Thanks

I focused so much on a grid that I didn’t realize that squares would work better.

I found a solution in:

it works great.