Preheat the oven to 400 degrees F (200 degrees C). Coat an 8-inch baking dish cooking spray.
Mix Parmesan cheese, rosemary, and garlic together in a bowl.
Slice 3 or 4 potatoes using a mandolin on the thinnest setting. Slice remaining potatoes using a slightly thicker setting on the mandolin.
Line the bottom of the prepared baking dish with thin potato slices, overlapping them to create a layer that is 2 to 3 slices deep. Stand remaining thin slices along the sides of the baking dish so that half an inch sticks over the rim, overlapping them to create a layer that is 4 slices deep.
Spread 1/3 of the thicker potato slices in the baking dish. Sprinkle 1/3 of the Parmesan cheese mixture on top. Repeat once more. Arrange remaining potato slices in the baking dish. Reserve 1/3 of the Parmesan cheese mixture.
Melt butter in a saucepan over medium heat; whisk in flour. Pour in milk; cook, occasionally stirring, until sauce thickens, 5 to 6 minutes. Stir in salt.
Shift potato slices in a few places with a knife to create wells for the sauce to flow through. Pour sauce evenly over potato slices in the baking dish. Sprinkle remaining 1/3 of the Parmesan cheese mixture on top. Brush potato edges sticking out of the baking dish with olive oil.
Bake in the preheated oven until potatoes are soft and edges are crusted, 1 hour to 1 hour and 15 minutes.