This is a text from the Rules Of Qiblah (there are 6 or 7 rules in case you don't know the direction of Qiblah, including trying to find it via Sun location, via star location, via Astrolabe).
792. If a person does not possess any means of determining the direction of Qibla, or in spite of his efforts, he cannot form an idea about it, it will be sufficient for him to offer his prayers facing any direction. And the recommended precaution is that, if he has sufficient time at his disposal, he should offer the same prayers 4 times, each time facing every one of the four directions.