We report the results of exact-diagonalization studies of Hubbard models on a 4x4 square lattice with periodic boundary conditions and various degrees and patterns of inhomogeneity, which are represented by inequivalent hopping integrals t and t('). We focus primarily on two patterns, the checkerboard and the striped cases, for a large range of values of the on-site repulsion U and doped hole concentration x. We present evidence that superconductivity is strongest for U of the order of the bandwidth and intermediate inhomogeneity 0 < t'< t. The maximum value of the "pair-binding energy" we have found with purely repulsive interactions is Delta(pb)=0.32t for the checkerboard Hubbard model with U=8t and t'=0.5t. Moreover, for near-optimal values, our results are insensitive to changes in boundary conditions, suggesting that the correlation length is sufficiently short that finite-size effects are already unimportant.