Geometric BRST quantization, I: Prequantization