I have read here and in some other places that if $$(a \circ b) \star (c \circ d) = (a \star c) \circ (b \star d)$$ for all $a,b,c,d$ in a set with two binary operations $\circ$ and $\star$, then each one is a monoid homomorphism.
My problem is that I don't quite understand in what sense these are monoid homomorphisms, since neither is a function $M \to M'$, but instead $M^2 \to M$, which confuses me somewhat. So, what exactly are these homomorphisms? Is $M^2$ supposed to be a monoid? If so, how?
Thanks.