I have the four coordinates of a rectangle in the format: (xi, yi). I want to find out which of the coordinates correspond to the top-left, top-right, bottom-left and bottom-right of the rectangle. Can someone help me in doing this? Any help is much appreciated. Thank you.
Edit: The rectangle can be a rotated rectangle. Is there any algorithm for this?