title: Perspective projection, 4 points
body: <p>I am trying to implement a perspective projection. For example, I have a square with a given size, and known corners' coordinates (A1 .. A4) . I have an image where this square is displayed at some specific position. I know its position and the coordinates of the corners of the displayed square B1 .. B4. I want to find a transformation matrix M that will
  translate B -> A. </p>
  
  <p>I followed method <a href="http://www.math.ubc.ca/~cass/graphics/manual/pdf/ch10.pdf" rel="nofollow">Mathematical Illustrations</a>, chapter 10, and I managed to transform 3 corners well. But I cannot find the matrix to transform correctly 4 corners... I find the matrix as on page 7, but it does not translate all 4 points well.</p>
  
  <p>~       </p>