Shader that is like BasicEffect but works with DrawInstancedPrimitives

In one of my games I have a 3D area that players can walk around in, and within this area I’m drawing a lot of instances of the same model (different orientations, and sometimes different textures). I get OK performance with ModelMesh.Draw() but it feels like the FPS could be better. I think this sounds like a good case for using DrawInstancedPrimitives. But I know jack all about 3D programming, this is my first time doing it. I’ve gone over some of the tutorials but I still don’t feel comfortable with shaders. It seems i need a custom shader to use DrawInstancedPrimitives, rather than BasicEffect. Right now I’m using BasicEffect and it has a lot of useful features like ambient / specular / diffuse and directional lights. I don’t know how to write a custom shader that would support the current capability of BasicEffect but also be able to be used for DrawInstancedPrimitives. Does anyone have an example of such a shader, or can point me in the right direction?