If it was straight to begin with, it's probably just the product of a drywaller cutting the hole out not quite straight. You might just cut away the part holding your box at an angle and push it back into form.
As far as in the future, unless it's a really deep box, once you get above 2 gangs in plastic nail on boxes, I usually toe in a 2X4 behind the box and slip a couple drywall screws through the back for farside support if the box feels like its a bit "twisty". this also keeps your box at proper depth all the way across smile