The screen rotation stopped working a few months ago (around the time of the Marshmallow update), and it's really beginning to get annoying. I can only take vertical pictures and videos, and some of my apps (like some astronomy apps) don't work correctly. I've powered it up in Safe Mode and tonight I finally did a Factory Reset, and it worked for a few minutes. Then it stopped again. How can this be fixed short of replacing the phone?