Run getPerspectiveTransform only if necessary.
Make variables static.