Old open clusters: UBGVRI photometry of NGC 2506