No time to write answer at the moment, especially if you know zero about vectors. So I'll leave this here. It is wordy but not difficult. Easier than calculus and Euler rotations but involves concepts you don't see as early as sin and cos but just takes a lot of book keeping of variables. You don't actually need sin and cos at all except one time during setup when you calculate your misalignment. After that you don't need it to perform your moment-to-moment transformations.
It is basically this but done for all three axis:
https://physics.stackexchange.com/questions/675998/how-do-i-get-the-total-acceleration-from-3-axes-in-negative/676038#676038
General approach is to make a three unit vectors in the coordinate system of your IMU, which we will call axis <i, j, k>, and have those unit vectors written in terms of ijk each points in the direction an axis of your vehicle coordinate system which we will call <x, y, z>.
Then dot product IMU outputs in vector form against each unit vector to project them in their entirety onto each axis of your vehicle coordinate system.
Since your vehicle unit vectors are orthogonal because you made them that way, then projecting IMU outputs get broken up completely with no components unaccounted for or missing.
Rotations about each axis follow right-hand rule.
BRIEF GUIDE AFTER YOU READ LINKED MATERIALS BELOW SO YOU HAVE SOMETHING MORE CONCRETE TO VISUALIZE IF YOU DON'T KNOW VECTORS AT ALL
So if your IMU ijk was aligned with vehicle xyz and then you rotated the IMU about the vehicle's x-axis by 45 degrees, then the xyz would be represented in the ijk coordinate system as unit vectors:
\$x: <1i + 0j + 0k> \$
NOTICE: We rotated about x-axis so i-axis still parallel with x axis so no change between those two axis, thus <1,0,0> for the x-axis unit vector when written in ijk coordinates.
\$y: <0i + \frac{1}{\sqrt 2}j - \frac{1}{\sqrt 2}k>\$
\$z: <0i + \frac{1}{\sqrt 2}j + \frac{1}{\sqrt 2}k>\$
NOTICE: Similarly, since we rotated about x-axis so i-axis still parallel with x axis everything on i-axis moves to x-axis and nothing on i-axis will get projected or distributed onto the y or z axis, thus the \$0i\$. However, j and k axis to get re-distributed to the y and z axis due to the 45 degree rotation thus the \$\frac{1}{\sqrt 2}>\$ of a 45 degree angle or triangle for both j and k.
Note how all unit vectors have a magnitude of 1, as they should.
Vectors represent magnitudes with directions in 3D space:
http://www.algebralab.org/lessons/lesson.aspx?file=Trigonometry_TrigVectorOperations.xml
Unit vectors are vectors with a magnitude of 1 so have a direction but when multiplied by other magnitudes impart a direction without changing the magnitude. They allow representation of a pure direction without inherent magnitude.:
http://www.algebralab.org/lessons/lesson.aspx?file=Trigonometry_TrigVectorUnits.xml
i, j, k are unit vectors along your cartesian coordinates. You can treat them kind of as letter variables multiplied with numerical scalar magnitudes to give directions to numbers. So you may do 1i+2j+3k to represent a vector. You may add or subtract two vectors written that way by adding or subtracting the terms as if i, j,k were variables. But you may not multiply or divide i, j, and k with each other. Dot and cross products are allowed for that (see later).
Dot Product is used to find the common component between two vectors. i.e. the parallel component The component that one vector projects onto the other. Dot product with a unit vector basically extracts the component of a vector for that unit vector
http://www.algebralab.org/lessons/lesson.aspx?file=Trigonometry_TrigVectorDotProd.xml
Cross Product is complimentary to dot product. It finds the orthogonal component between two vectors. Cross product with a unit vector gives the component NOT along the direction of the unit vector (i.e. perpendicular):
http://www.algebralab.org/lessons/lesson.aspx?file=Trigonometry_TrigVectorCross.xml