Going mechanical is the Lego way
Anyway, it seems you are codding like this: move 90º, move -90º, move 90º…..
Doing it this way means that errors accumulate, and you might get what you got, 90 degrees out of sync.
Instead, I suggest something like: go to 45º angle, go to -45º angle, go to 45º angle… this way, errors do not accumulate... and you wont even need to go to 0 to initialize.