Acquiring the Top Left Bottom Right coordinates of a rectangle

I want to accurately find out the top left bottom right coordinates of an object. Let’s say an rectangle. please help me.