overdrawing elements

Hi community,

is there a way(method) how to check if some rectangle is being overwrite with another rectangle?

I am drawing rectangles at specific positions at my app but i dont really know how big they will be, so i want to create some function to check if they are overdrawing each other at some area and in this case show some error..

Thanks for reply.