Once the Homography matrix calculations were done, the process of rectification became elementary. All that is needed to rectify an image is to select 4 points in the original image which are known to be in a square in real life but appear warped due to the perspective of the image. Then select 4 points in an imaginary square (ex. [0, 0], [0, 1], [1, 0], [1, 1]) and use those as the reference points for computing the H matrix. Lastly, the H matrix is applied to the points in the original image which results in the rectified image shown below.