It's not "rogue" at all. The NSA's explicit purpose is to do intelligence gathering and analysis on foreign threats. That's its core competency - data mining. If you look at the mission statement, it says its goal is to do intelligence gathering.
It would be rogue if it decided to, say, give crucial information to a foreign country at the expense of the United States.