Preheat your oven to 325°F (this lower temperature prevents browning edges while centers stay tender). Add softened butter and granulated sugar to a mixer bowl, then beat on medium speed for 3–4 minutes until fluffy. I always scrape down the bowl halfway through, because butter hiding along the sides won't incorporate evenly. This step matters because proper creaming traps air, which creates that delicate shortbread texture you're after.
Add the egg and vanilla powder, mixing for 2 minutes on medium speed until combined. The mixture will look slightly broken—that's completely normal and actually what you want here. Beat until it comes together smoothly and the vanilla dissolves into the wet mixture without visible specks.
In a separate bowl, whisk together flour, salt, and baking powder. Pour this dry mixture into the wet ingredients, then mix on low speed for 30–45 seconds only. Overmixing creates tough cookies, and I learned that the hard way years ago when I treated this like bread dough. Stop the moment you don't see dry flour streaks anymore.
Divide the dough into three portions. Leave one plain, then knead red food coloring into the second portion (10–15 kneads with your hands), and blue coloring into the third. The warmth of your hands helps the colors distribute without adding extra liquid. You'll end up with three distinct doughs ready for layering.
Press the plain dough into the bottom of an 8x8-inch baking dish, flattening it with your fingers until even. Layer the red dough on top, pressing down gently, then finish with the blue dough layer. The colors will stay somewhat separate—that's the visual magic of 4th of july shortbread cookies cozy recipe right there. Press the entire stack down with your palm so layers don't separate during baking.
Score the shortbread into 24 squares with a sharp knife before baking (it's so much easier now than after baking). Sprinkle the nonpareils evenly across the top, pressing them in slightly so they stick during baking. Place the dish in the preheated oven for 38–42 minutes until the edges turn light golden but the center stays pale. The shortbread should feel firm to a light touch when done.
Remove from the oven and let cool in the pan for 10 minutes, then turn out onto a wire rack to finish cooling completely. This resting period prevents the cookies from breaking apart when you cut through them. Once fully cool, cut along your scored lines and dust with powdered sugar for a subtle finish.