Melt butter over medium low heat.
Add shallot and saute' 2-3 minutes.
Add garlic and saute' 1 minute.
Whisk in flour.
Gradually add half and half whisking constantly and continue cooking and whisking until thickened.
Remove from heat and stir in cheese, salt, pepper and rosemary.
Layer ½ the potatoes in a 9x13 inch baking dish. Top with half the sauce. Repeat.
Cover and bake at 400 degrees for 50-60 minutes, or until potatoes are tender, uncovering during last 15 minutes.
Allow to rest about 10 minutes before serving. Garnish with additional rosemary if desired.