title: Given four Corner vertices of a rectangle, how to identify all upper and lower (left & right) corner points?
body: <p>Four Corner Vertices of a deformed rectangle are given i.e. <code>p1(x1,y1),</code> <code>p2(x2,y2),</code> <code>p3(x3,y3)</code> &amp; <code>p4(x4,y4)</code>. </p>
  
  <p>How to find position of all co-ordinates i.e. which one is upper left, upper right, lower right and lower left? </p>
  
  <p>I am working with MATLAB. </p>
  
  <p><em>Clarification:</em>  The rectangle is not necessarily axis aligned. It may be slightly tilted.</p>