Use the FindHomography method.
Feed it the 4 source points. For the destination points, you will have to do some math as in where the 4 points should lay down in the destination image. A simple, straightforward operation to start with would be:
(from top-left going clockwise)
A' = (A.x, A.y)
B' = (A.x + length, A.y)
C' = (A.x + length, A.y + width)
D' = (A.x, A.y + width)
Map (A,B,C,D) to (A', B', C', D') using the FindHomography().
Where width and length are those of the identified rectangle.