How can I code this Accelerometer to calculate rotation?

Hello, I have an MPU-9250 Accelerometer (the link is attached below);

What's the formula for programming this to calculate the degrees of rotation? (90 degrees to be specific).

I am beyond lost with getting started, so anything information helps!

How good is your calculus?

trigonometry -- determining rotation from gyro

(had thought it was simply atan2(), but i think quaternions avoid what they call "gimbal lock" which i believe means when atan == infinity)

Oh I missed the magnetometer part... in that case you don't need to integrate to convert acceleration into position.

There are several 3D orientation "fusion filters" available for the MPU-9250, but some (e.g. Sparkfun and Kris Winer) don't work at all. Here is one of several that does.

It is essential to calibrate the sensor, in order to get meaningful results.

The accelerometer will only tell you which way is 'down'. The gyroscope will tell you how fast you are turning but not how far you have turned. I think only the magnetometer will tell you which way you are facing so you can calculate how far you have turned.