99.9% sure that's a structural problem. There's definitely water infiltration to the point it has rotted the framing in the corner. I've seen it before, and it's not easy to fix. 10 to 1 that the roof has shifted one way or the other to follow the sagging framing. By the way, when I reframed the house this happened to, we had to tear off the entire second floor and build from scratch. It was worth it for me because I did the work myself after we bought the house for 55k in Chicago. Still, the remodel cost another 50k. If you're not a professional carpenter, run away.