title: How to map rectangle image to quadrilateral with PIL?
body: <p>Python PIL library allows me to map any quadrilateral in an image to rectangle using</p>
  
  <pre><code>im.transform(size, QUAD, data)
  </code></pre>
  
  <p>What I need is a function that does the opposite, i.e. map a rectangular image to specified quadrilateral.</p>
  
  <p>I figured this might be achieved with the above mentioned function like this:</p>
  
  <p><a href="https://i.stack.imgur.com/Sw8NI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sw8NI.png" alt="enter image description here"></a></p>
  
  <p>I.e. I would find such quad (the red one in the image) that would, using the function im.transform(size, QUAD, data) transform the image to quad I want. The problem is I don't know how to find the red quad.</p>
  
  <p>I would appreciate any idea on how to find the red quad or any other way to map a rect image to quad, only with PIL if possible.</p>