I looked through Shulchan Aruch, but, although there are entire chapters (OC 453–462) describing how to make matza, there's a not a single mention of how to make hamentaschen. What is the halachically correct way to make hamentaschen? Sourced answers would be preferred.
The only aspect of hamentashen that is miakev is the triangular shape.
Matzos are round* because they serve to remind us of Hashem, the point of perfection, with no beginning and no end, an idea found many times in the writing of the Maharal.
Most mitzvos are square, such as Tephilin, Talis, Beis Hamikdosh, Klei Mikdosh because this shape represents man's accomplishments, as Hashem did not create squares in this world. The Yerushalmi (מעשרות ה׳ ג׳) says He only created one square item, the Gris HaKilki, but that was probably just to show that he could.
Hamentashen are a remembrance for Esther, as such they must be triangular to represent womanhood, as Rashi says in Bereishis 2 22 Hashem made women like a building/storehouse, thin on top and wide on the bottom so as to be able to hold children.
*Obviously, the advent of machine Matzos and their square shape needs further introspection to what we are meant to learn from their shape and what it says about the generation that utilizes them.