With an electric mixer, mix the butter and sugar on medium-high speed until smooth, about 4 minutes. Add the eggs, one at time, and vanilla extract.
Reduce the speed to medium-low and add the flour, baking powder, and salt. Mix until just incorporated, stopping once or twice to scrape down the sides with a rubber spatula. Cover the cookie dough with plastic wrap and refrigerate for 1-2 hours.
Preheat the oven to 400 degrees and line a baking sheet with parchment paper.
Sprinkle some flour on a clean surface, and knead the cookie dough on the floured surface 6-8 times. Roll the cookie dough with a rolling pin until it's about ¼ inch thick. Sprinkle and gently rub the top of the cookie dough with some flour. With a cookie cutter, cut out the dough and place on the prepared baking sheet.
Bake for 6-7 minutes. Allow the cookies to cool on the baking sheet for 8-10 minutes, then transfer to a wired rack to finish cooling.
For the icing:
Combine all the ingredients in a large mixing bowl. Mix on high speed until smooth, about 5 minutes. For thinner icing, add more water, 1 teaspoon at a time. Pipe or spread on cooled cookies.
Recipe by Sprig and Flours at http://www.sprigandflours.com/sugar-cookies-with-royal-icing/