Rotating quad around itself but move it to a specific position of another quad

i have the following problem: i have following setup:

The red quad should always keep the position relative to the white quad. I got this working by using the same translation and rotation matrix as the white quad.
The red one “recieves” the matrices from the white one.

img at: (would have used IMG tag, but was denied :frowning: )

Now i want to rotate the red quad around itself. I do it, by adding the amout of degree to the one recieved from the parent object and using it as the values for the rotation matrix:

cos(deg+turnDeg), -sin(deg+turnDeg), 0.0, 0.0
sin(deg+turnDeg),  cos(deg+turnDeg), 0.0, 0.0
             0.0,               0.0, 1.0, 0.0
             0.0,               0.0, 0.0, 1.0

deg: the amout the white quad is rotated
turnDeg: the amount the red quad should be rotated

The problem now is, that if i let it rotate, it starts rotating around the center of the white quad.

I now have the question, how i can rotate it around itself but let it stay at the position relative to the white quad?

Source of the VertexShader:

#version 150 core

in vec4 in_Position;
in vec4 in_Color;
in vec2 in_TextureCoord;

uniform mat4 window_Matrix;
uniform mat4 ikarus_Rotation_Matrix;
uniform mat4 translation_Matrix;
uniform mat4 ntranslation_Matrix;

out vec4 pass_Color;
out vec2 pass_TextureCoord;

void main(void) {
	gl_Position = window_Matrix * translation_Matrix * ikarus_Rotation_Matrix *  in_Position;
	pass_TextureCoord = in_TextureCoord;
	pass_Color = in_Color;


To rotate an object around itself you must do the following

  1. translate the object rotation point (in your case the object’s centre) to the origin
  2. rotate the object
  3. translate the object rotation point back to it’s location