Assign the event handler here so we can use a nested function that has accessl to the local variables.
And be sure to keep the button disabled until the image is rotated so the user can't click done before we're ready.