Quaternion Converted to Rotation Matrix then Derived with Respect to this Quaternion

I was wondering how a derivative of a rotation matrix generated based on a quaternion and then differentiated with respect to this quaternion would be calculated.

$$q_{1\times 4} = [q_0 q_1 q_2 q_3]^T$$

$$d_{rot_{3\times3}} = \frac{\delta C(q)}{\delta q}$$

If I attempt to lay out the rotation matrix by its elements and derive it with respect to each quaternion element, I would need to differentiate a matrix w.r.t. a vector which results in a 3D tensor differentiation see here. But If it is possible to derive it from the symbolic expression it eventually should remain 2D.

As a second case: If I rotate a vector with this rotation and differentiate it afterward, then I get a 2D Jacobian.

$$d_{rot_{3\times3}} = \frac{\delta \left(C(q_1) \cdot v_{3x1}\right)}{\delta q}$$

I'm trying to remain in 2D if possible. Also, rotation quaternions do have norm = 1 if this helps to simplify the differentiation.

Furthermore, I'm also interested in the Rank and if this constellation always has full Rank, then I would need to prove it.

J. Kelly "Indirect Kalman filter for 3D Attitude Estimation"

Lemma 1 Shows that based on the unit quaternion fact, the result in his example should have full Rank. But this only accounts for a quaternion and not for a rotation matrix based on quaternions.