I've been in your position.
First thing to do is go to your boss (the old one, not the one you've just been given) and demand to know why you've been demoted, and what your future is. Demand is not too strong a word here. You should be polite, but you should not allow them to fob you off with nothing. You are entitled to an explanation. You should get an explicit statement from them as to whether they had any issues with your performance. You should also expect to know what your future is going to look like, and when you might expect to get a similar level of responsibility that you had before. From my experience companies do not demote people and then promote them again later. When it happened to me, not only was I never given an equivalent post, but when the new boss left someone else was given my old job.
Your next decision is "Do I want to continue working in this demoted role". Everything I read in your question says you shouldn't. You won't be getting the experience you want, and frankly if you've been demoted it's a sign they don't want you in that role, no matter what reason they give. If you decide you are happy in your new role, and with the reduced prospects, then follow HLGEM's advice.
If you are not happy, then start looking for another job. Also consult a lawyer. It's possible that the company's actions may constitute 'constructive dismissal, i.e. you've been fired without being fired. If that's the case you may be able to claim severance or other compensation