$p$-adic periods, $p$-adic $L$-functions, and the $p$-adic uniformization of Shimura curves