In a large skillet, melt the butter over medium heat. Add the diced onion and sauté until translucent, about 5 minutes. Stir in the minced garlic and cook for an additional minute until fragrant.
Once the onion and garlic are cooked, add the thawed spinach to the skillet. Season with salt and pepper to taste. Cook for about 3-4 minutes, allowing any excess moisture to evaporate.
In a large mixing bowl, combine the spinach mixture with chopped parsley or dill, crumbled feta cheese, shredded mozzarella or parmesan cheese, and softened cream cheese. Mix everything together until well combined.
Preheat your oven to 400°F (200°C). On a lightly floured surface, roll out the puff pastry sheets to smooth out any creases. Cut each sheet into 4 equal squares.
Spoon a generous amount of the spinach filling onto the center of each pastry square. Be careful not to overfill, as this can cause them to burst during baking.
Fold the corners of each pastry square over the filling to create a triangle shape. Press the edges together to seal, and use a fork to crimp the edges for an extra decorative touch.
Place the sealed pastries on a lined baking sheet. Brush the tops with the beaten egg, which will give them a beautiful golden color when baked.
Bake the pastries in the preheated oven for 20-25 minutes, or until they are puffed and golden brown. Keep an eye on them to prevent burning.