Set two 4- to 6-quart stockpots on the stove, clip a candy thermometer to one, and get a 9-by-9-inch baking dish ready with foil and a generous coat of nonstick cooking spray. Press the foil flat into the corners so the slab will lift out without deep creases.
Bring 4 cups granulated sugar and 1 ½ cups water to a boil over high heat in the pot with the thermometer. Keep the syrup boiling until the thermometer reads 240 °F.
Whisk the lemon juice, cornstarch, and cream of tartar into the remaining 2 ¾ cups water in the second pot, then whisk over high heat until the mixture thickens. Look for a smooth, glossy white paste that clings to the whisk without any lumps.
Feed the hot syrup into the starch paste in small additions, whisking each addition smooth before pouring in more. A helper can whisk while you pour, making it easier to keep the stream slow and steady and limit splashes.
Bring the combined mixture to a gentle simmer over medium heat and cook for about 45 minutes, stirring occasionally and sweeping the spoon across the bottom of the pot. The candy is ready when it looks like a thick, translucent golden-orange jelly and offers noticeable resistance as you stir.
Take the pot off the heat, stir in the rosewater if using, both extracts, and the salt, then add the optional food coloring and transfer half the candy to the prepared dish. The gel should still flow from the pot, so have the dish close by before you start flavoring.
Scatter the optional pistachios over the first layer and promptly cover it with the rest of the candy. For nuts throughout rather than a stripe in the middle, fold them into the hot candy before transferring any of it, then pour the whole batch into the dish at once.
Refrigerate the filled dish for 30 to 60 minutes. The slab should feel firm enough to hold its shape when turned out.
Invert the slab, strip away the foil, and divide the candy into about 100 small squares with a sharp knife or kitchen shears. The chilled slab should hold still under the blade rather than slump as you cut.
Tip the powdered sugar into the now-empty baking dish and shake the freshly cut pieces in it as you work. Turn the squares until every side is dusted, especially the sticky cut edges.
Let the coated pieces sit at room temperature. They may feel quite firm straight from the refrigerator, but the bite softens as they lose their chill.