Generalizing Under Distribution Shifts and Data Scarcity via Geometrical and Knowledge-Aware Deep Learning