Place the flour, sugar, rosemary, and salt in the bowl of a food processor fitted with the blade attachment and pulse to combine, 2 to 3 quick pulses.
Add the butter and pulse to combine. Continue pulsing until the mixture sticks together when pressed with 2 fingers, about 30 (1-second) pulses. Use a rubber spatula to scrape down the sides of the bowl and make sure the dough is evenly mixed.
Place 2 sheets of plastic wrap about 15 inches long on a work surface. Divide the dough into 2 even portions (about 10 ounces each) and shape each portion into a 6 ½-inch-long log that is about 1 ½ inches in diameter. Place each log on a sheet of plastic wrap at a long end, then roll up to completely wrap in plastic. Twist and tie the ends together.
Freeze until firm, about 1 hour. The dough can be stored in the freezer for up to 1 month.
Arrange 2 racks to divide the oven into thirds and heat to 350°F.
Unwrap one of the logs and trim the rounded ends. Cut it into 20 (¼-inch-thick) rounds, rotating the log a quarter turn after every slice. Place all the rounds on an ungreased, unlined baking sheet, spacing them at least 1 ½ inches apart. Repeat with the second log to fill up a second baking sheet. Sprinkle with the flaky salt if using.
Bake for 10 minutes. Rotate the baking sheets between racks and from front to back, then bake until just set but not browned, 9 to 10 minutes more. Let cool on the baking sheets for 5 minutes, then transfer to a cooling rack to cool completely.
