If there are only fixed snap locations without other shapes or sizes, I would try using invisible helper sprites to snap to. You'll need two sets, one for triangles and one for squares, since the distance to the center of each is different. Set the helper sprite angle to the angle between itself and the object that created it (rounded).
So placing a square would create 8 helper sprites, one for each square and triangle at each snap location. 6 helpers would be created for triangles. When placing a new shape, check only the correct helper type to snap to, and if it's close enough to snap then set the angle of the new shape based on the angle of the helper sprite it snapped to.
Destroy any helpers that are already overlapping a shape.
Edit: make sure your "connecting" flat edge is facing towards the right (0 degrees) for the triangle sprite