This question already has an answer here:
This is related to another question, in which one wants to rewrite a function of a single variable in terms of another function of that variable. Here I have a function of multiple variables. I want to rewrite the following complex trigonometric expression
(-1 + 3 Cos[A]^2) (-1 + 3 Cos[a]^2) + Cos[B - b] Sin[2A] Sin[2a] + Cos[2(B - b)] Sin[A]^2 Sin[a]^2
in terms of the trigonometric expression
Cos[A] Cos[a] + Cos[B - b] Sin[A] Sin[a]
How can I do that in Mathematica?