Special equipment: a madoline, optional
Preheat the oven to 350 degrees F. Rub the bottom of a 9-by-13-inch baking dish with softened butter.
Using a mandoline or a very sharp knife, slice the potatoes very thinly. They'll cook better that way. Place the potatoes in the baking dish and sprinkle with 1/2 teaspoon salt and some pepper.
In a large skillet over medium-low heat, melt the butter. Add the garlic and onions and cook until translucent, stirring occasionally, about 4 minutes. Cut the bar of cream cheese in half and add the halves to the skillet, stirring constantly. Continue stirring until the mixture is smooth and combined, about 3 minutes. Pour in the half-and-half and stir to combine. Mix in 1/2 teaspoon salt and some pepper. Taste and adjust the seasonings as necessary. Do not undersalt! Add the rosemary and green onions and stir to combine. Finally, mix in 1/2 cup of the grated Parmesan.
Pour the cream cheese mixture over the top of the potatoes. Scrape out the skillet to get every last drop. Sprinkle the remaining 1/2 cup grated Parmesan generously over the top and bake until golden brown and bubbly, at least 1 hour. Let stand for 10 minutes before serving.