Disclaimer: Looking into this aspect of Hinduism may be depressing for some. Discretion is advised.
Varna can be determined by the Nakshatra as is told by Lord Shiva in the Karamvipakasamhita to Devi Parvati. In the second Adhyaya of the text we have
अश्विन्याः प्रथमे पादे यदा जन्म प्रजायते |
तदा ब्रह्मणवर्णोऽयं मध्यदेशसमुद्भवः || 1 ||
द्वितियचरणे देवि पुरा क्षत्रि न चान्यथा |
अयोध्यापुरतः पूर्वम् पुत्रकन्याविवर्जितः || 2 ||
तृतीयचरणे देवि वैश्यवर्णसमुद्भवः |
रोगी कुत्सितवर्णोऽयं मृतवत्सो नपुंसकः || 3 ||
The translation is as follows
Of the Ashwini in the first stage when one takes birth |
Then Brahmana he in the middle of the country || 1 ||
In the second stage, O Devi, first Kshtriya and nothing else |
In the east of Ayodhya without son and wife || 2 ||
In the third stage, O Devi, to Vaishya he is born |
Diseased a disgraceful varna he like dead, impotent || 3 ||