If you narrowed the issue to your phone, and nothing else . . . then take a backup, and reflash the ROM. (You can dirty flash the ROM without wiping it. It just reflashes everything as it was originally was from the ZIP in TWRP) If the issue persists, then reflash another ROM. If that still fails, run the RUU for your HTC version/carrier.
If that fails, it could be hardware related. I hope the above fixes your issue.