Cream the softened butter and sugar together in a large bowl until light and fluffy (about 3 minutes).
Add the egg, vanilla extract, and almond extract if using, then beat until well incorporated.
In a separate bowl, whisk together the flour, salt, and baking powder. Gradually add the dry ingredients to the wet mixture, mixing just until combined.
Form the dough into a disc, wrap it in plastic wrap, and refrigerate for at least 1 hour.
Preheat your oven to 350°F (175°C) and line baking sheets with parchment paper.
On a lightly floured surface, roll out the chilled dough to about ¼-inch thickness. Use a square cookie cutter (approximately 2-3 inches) to cut out shapes.
Transfer the cut cookies to the prepared baking sheets, leaving about 1 inch between each cookie.
Bake for 10-12 minutes, or until the edges are just beginning to turn golden. Allow to cool on the baking sheet for 5 minutes before transferring to a wire rack to cool completely.
In a stand mixer fitted with the paddle attachment, combine the powdered sugar and meringue powder. Add warm water and vanilla extract, then mix on low speed until combined.
Increase to medium-high speed and beat for 4-5 minutes until stiff peaks form. Divide the icing into portions for different colors, keeping some white for the base layer.
Thin a portion of your royal icing with a few drops of water to create "flood consistency" for the base layer. Pipe an outline around each square cookie, then fill in the center.
Let this layer dry completely (about 1-2 hours).
Once dry, use stiffer icing to attach a chocolate square to each cookie at an angle, creating the mortarboard.
Add a small dab of icing and place your chosen candy in the center for the button.
Finally, pipe a small tassel from the button to the edge of the cap using colored icing or attach a piece of licorice.