Realigns x and y positions based on alignment constants (CENTER, LEFT, RIGHT, TOP, BOTTOM) relative to the given window.