How to edit the vertex shader for shaderMaterial to rotate instancedMesh?

I am going to use shaderMaterial for instancedMesh.

There are many octahedron geometries listed as a plane.

As I didn’t use instancedMesh before, i’m sucks.

<instancedMesh ref={ref} args={[null, null, count]}>
 <octahedronGeometry args={[1]} />
 <curlNoiseMaterial uTime={1.0} />
</instancedMesh>

I gonna use ‘curl noise’ for shaderMaterial and edit vertex shader.
My target like this:

I googled and find some info as the below link,

The upper part is solved.

vec4 mvPosition = InstanceMatrix * vec4(position, 1.0);

Now, I found that the InstanceMatrix[3] col is related to position.
InstanceMatrix(0) is related to scale-x
InstanceMatrix(5) is related to scale-y
InstanceMatrix(10) is related to scale-z

And, InstanceMatrix(5,6,9,10) are related to rotation-x.

Why there are 4 values controlling one rotation :sweat_smile: ?

For future reader,

InstanceMatrix[3][0]
InstanceMatrix[3][1]
InstanceMatrix[3][2]

They are belongs to the position xyz