Refactor to utilize affine transforms.