Should Prayers Performed Without Facing the Qiblah be Repeated?
Question

I prayed opposite to the direction of the Qiblah without making the effort to work it out for more than a month, because I moved to a new apartment where I thought that the Qiblah was in the same place. Should I repeat all the prayers? Can I pray them all at one time?
Praise be to Allah.Understanding the Importance of Facing the Qiblah in Prayer
The worshipper should face towards the direction that he is certain is the Qiblah, if he knows it . If he does not know the direction for sure, then he should make the effort to work it out, so that he will be praying in the direction that he thinks is most likely to be the Qiblah.
If someone prays when he is unsure of the direction of the Qiblah , and he is able to make the effort to work it out, then he is falling short and he must repeat the prayer.
Ibn `Abd Al-Barr (may Allah have mercy on him) said:
The scholars unanimously agreed that if someone prays not facing towards the Qiblah  and without making the effort to work it out, his prayer is not valid and he must repeat it facing towards the Qiblah. This is similar to the case if he prayed without purifying himself.
A similar ruling applies to the one who prays in a mosque where he can easily work out the Qiblah from the Mihrab and the like, but he does not do that, and prays facing a different direction.” (End quote from At-Tamhid,  10/426)
But if he put effort into trying to work it out and got it wrong, then his prayer is valid and he does not have to repeat it.
Ibn `Abd Al-Barr (may Allah have mercy on him) said:
Examining this issue leads us to conclude that the individual does not have to repeat the prayer that he offered facing what he thought was the direction of the Qiblah after making the effort to work it out, because its direction was not clear. That is because he has done what he was commanded to do and he has done what was required of him of making the effort to seek indications of the Qiblah, then he thought that he was facing the right direction, then after he had prayed he realized that he had made a mistake.
Conditions for Repeating Prayers if the Qiblah Direction is Missed
The scholars unanimously agreed that in this case, he did what is permissible for him to do and, in fact what he was obliged to do (that is, put effort into working out the direction).
However, they differed as to whether he has to make up that prayer, if it became clear to him that he had made a mistake regarding the Qiblah. Suggesting that he must repeat it means that it is obligatory, and what is obligatory cannot be proven except on the basis of certainty with no room for doubt.”(End quote from At-Tamhid  10429)
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said:
The correct view is that if he put effort into working it out when he was not travelling, then his prayer is valid. If he got it right, then the matter is clear; if he did not get it right, meaning that he put effort into working it out but got it wrong , he will still be rewarded for his effort. If he had put effort into trying to work it out, he does not have to repeat the prayer at all, whether he got it right or not, because he did what was required of him. The one who has done what is required of him has done what he could to protect himself from the punishment of Allah, and whoever does what he can to protect himself from the punishment of Allah does not have to pray twice, because Allah has not obliged His slaves to do any act of worship twice, if they do it in the manner enjoined…
Summary of the matter:

If someone puts effort into trying to work it out, his prayer is valid, whether he got it wrong or right, and whether he is travelling or not, according to the more correct scholarly view.
If he prayed without putting effort into trying to work it out and was not following someone else, then if he got it wrong, he must repeat the prayer, and if he got it right he does not have to repeat it, according to the correct view.”(End quote from Ash-Sharh Al-Mumti`  1/286-287).

There are many ways to work out the Qiblah; it is not limited to one way. Each of these ways could indicate its direction, so they are valid ways of working it out.
Ibn `Abd Al-Barr (may Allah have mercy on him) said:
The scholars unanimously agreed that anyone who is far away from the Ka`bah  must turn his face towards it, so the one who cannot tell in what direction it is may look for whatever he can that will indicate its direction, such as the stars, the mountains, the winds and so on, from which he will be able to work out its direction.” (End quote from At-Tamhid  10/426)
The easiest way to work out the direction of the Qiblah nowadays, which is the most readily available to people, is using a compass which shows the direction of the Qiblah, especially as they are available on most modern cell phones, and there is no longer any need for a specialized instrument that may not be available to the Muslim when he needs it.
If you neglected to use the compass on your cell phone, even though you were aware of it and were aware of the importance of finding out the direction of the Qiblah, then you must repeat your prayers.
But if it never crossed your mind, or you were not aware that it was there on your phone, or you did not know how to use it to find out the direction of the Qiblah, and you made an analogy between your new apartment and your old apartment, and you believe that they faced the same direction, then we may note that analogy is one of the ways of finding things out, and we hope that there will be no blame on you for what you did, and that you have done what you could.
Does Effort Justify Mistakes in Qiblah Direction?
But if you think that you fell short and did not put enough effort into trying to work it out in order to be certain of the direction of the Qiblah and find out its indications, or if you want to be on the safe side and be free of blame, then erring on the side of caution in such matters is a good idea.
Based on that, you must repeat the prayers that you offered when you were not facing towards the Qiblah. Making up prayers is to be done in the correct order and is to be done immediately, if you are able to do that.
The Permanent Committee for Academic Research and Ifta’ was asked:
What is the order of making up Fajr, Dhuhr and `Asr prayer when a person remembers that he has not prayed?
Answer:
Making up missed prayers must be done immediately, and must be done in the proper order, as enjoined by Allah, may He be glorified. This means praying Fajr, then praying Zuhr, then praying `Asr.
And Allah is the source of strength. May Allah send blessings upon our Prophet Muhammad and his family and companions. (Permanent Committee for Academic Research and Ifta’-Shaykh `Abdullah ibn Munayyi`, Shaykh `Abdullah ibn Ghadyan, Shaykh `Abd Rr-Razzq `Afifi- End quote from Fatawa Al-Lajnah Ad-Da’imah – Vol. 1, 6/159)
When Should Prayers Be Repeated Due to Qiblah Errors?
With regard to someone who prayed not facing towards the Qiblah, if he put sufficient effort into trying to work it out and did what was required of him, then it turned out that he was not facing towards the Qiblah, the prayer that he offered is valid and he does not have to repeat the prayer.
But if he was heedless about looking for indications of the Qiblah, or he fell short in his efforts, he must repeat the prayers that he offered not facing towards the Qiblah. He must offer them in order, to the best of his ability.
If he fears that he may have been negligent or did not put enough effort into finding indications of the Qiblah, then it is a good idea for him to err on the side of caution and make up the prayers that he offered not facing towards the Qiblah.
And Allah knows best.