You could try the “diagonal flip” method that will be less sensitive to squareness problems. It is sensitive to overall dimensional problems if X and Y don’t have the same scale, but the overall size is easier to get precise.