The impact of sunspot rotation on solar flares