Your position (and buffs and debuffs and basically everything) is calculated when you begin the attack. Note: you can press the button before the GCD is available, so you can press the button before the attack begins. But stuff is calculated when the attack begins.

After the attack starts you can do whatever. Run into a conflag. Die. Turn around. Circle through the tank. Your side/rear attack will still get the side/rear bonuses.